Skip to content

Conversation

@itskingori
Copy link
Member

If the X-Request-ID is passed along, then it's easier to follow the chain of calls upstream. See commits for details. Each commit is an idea.

@itskingori itskingori requested a review from a team as a code owner February 10, 2021 08:53
Copy link
Member Author

@itskingori itskingori left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some commentary ... 💬

Comment on lines 1 to +3
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
'"$http_user_agent" "$http_x_forwarded_for" $proxy_x_request_id';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to improve this log format to have a little more information but I think that's best done in another PR. Using the Kubernetes Ingress - Ingress log format as inspiration ...

log_format upstreaminfo
    '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" "$http_user_agent" '
    '$request_length $request_time [$proxy_upstream_name] [$proxy_alternative_upstream_name] $upstream_addr '
    '$upstream_response_length $upstream_response_time $upstream_status $req_id';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can get behind this 👌

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to improve this log format to have a little more information but I think that's best done in another PR. Using the Kubernetes Ingress - Ingress log format as inspiration ...

Done in #6.

proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl;
proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port;
proxy_set_header X-Request-ID $proxy_x_request_id;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some apps like Rails with use this as the request_id if the X-Request-ID exists. Else, they generate one. So it's certainly useful to set it here because it will be used upstream. See ...

Screenshot 2021-02-10 at 12 01 48

Copy link
Member

@zacblazic zacblazic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally beat me to this. 🏆

@itskingori itskingori merged commit caa3c62 into master Feb 10, 2021
@itskingori itskingori deleted the add_support_for_request_tracing branch February 10, 2021 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants